//
//  MapCity.m
//  FoodFamily
//
//  Created by Bang-guo on 15/6/30.
//  Copyright (c) 2015年 guoBang. All rights reserved.
//

#import "MapCity.h"

@implementation MapCity
+(instancetype)mapCityShareDataHandle {
    
    static MapCity *mapCitySql = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        
        mapCitySql = [[MapCity alloc] init];
        
        
    });
    
    return mapCitySql;
}

-(void)createMapCityTable {
//    cityId;
//    cityChineseName;
//    cityPinyinName;

    NSString *sql = @"CREATE TABLE IF NOT EXISTS mapCity(number INTEGER PRIMARY KEY AUTOINCREMENT, cityId TEXT, cityChineseName TEXT)";
    
    [CommonSQL operateTable:sql];
    
}

-(void)dropMapCityTable {
    NSString *sql = @"DROP TABLE mapCity";
    [CommonSQL operateTable:sql];
}

-(void)insertMapCityValue {
    NSString *sql = [NSString stringWithFormat:@"INSERT INTO mapCity (cityId, cityChineseName) VALUES('1', '杭州'), ('2', '上海'), ('3', '北京'),('7', '大连'), ('5', '广州'), ('6', '深圳'), ('9', '武汉'), ('11', '成都'), ('223', '青岛'), ('13', '全国')"];
    [CommonSQL operateTable:sql];
}

-(MapCityModle *)selectMapCityValue:(NSString *)cityPinyinName {
    MapCityModle *city = [CommonSQL selectMapCity:cityPinyinName];
    return city;
}

-(NSMutableArray *)selectMapCityAll {
    NSMutableArray *array = [CommonSQL selectMapCityAll];
    return array;
}


@end
